

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>3.5. Hydrogen Bond analysis — MDAnalysis.analysis.hbonds &mdash; MDAnalysis v0.7.5-devel documentation</title>
    <link rel="stylesheet" href="../../_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.7.5-devel',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within MDAnalysis v0.7.5-devel documentation"
          href="../../_static/opensearch.xml"/>
    <link rel="shortcut icon" href="../../_static/mdanalysis-logo.ico"/>
    <link rel="top" title="MDAnalysis v0.7.5-devel documentation" href="../../index.html" />
    <link rel="up" title="3. Analysis modules" href="../analysis_modules.html" />
    <link rel="next" title="3.6. HELANAL — analysis of protein helices" href="helanal.html" />
    <link rel="prev" title="3.4. Generating densities from trajectories — MDAnalysis.analysis.density" href="density.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="helanal.html" title="3.6. HELANAL — analysis of protein helices"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="density.html" title="3.4. Generating densities from trajectories — MDAnalysis.analysis.density"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../analysis_modules.html" accesskey="U">3. Analysis modules</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/mdanalysis-logo-200x150.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">3.5. Hydrogen Bond analysis &#8212; <tt class="docutils literal"><span class="pre">MDAnalysis.analysis.hbonds</span></tt></a><ul>
<li><a class="reference internal" href="#output">3.5.1. Output</a></li>
<li><a class="reference internal" href="#detection-of-hydrogen-bonds">3.5.2. Detection of hydrogen bonds</a></li>
<li><a class="reference internal" href="#example">3.5.3. Example</a></li>
<li><a class="reference internal" href="#classes">3.5.4. Classes</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="density.html"
                        title="previous chapter">3.4. Generating densities from trajectories &#8212; <tt class="docutils literal docutils literal docutils literal"><span class="pre">MDAnalysis.analysis.density</span></tt></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="helanal.html"
                        title="next chapter">3.6. HELANAL &#8212; analysis of protein helices</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/documentation_pages/analysis/hbonds.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="module-MDAnalysis.analysis.hbonds"></span><div class="section" id="hydrogen-bond-analysis-mdanalysis-analysis-hbonds">
<h1>3.5. Hydrogen Bond analysis &#8212; <a class="reference internal" href="#module-MDAnalysis.analysis.hbonds" title="MDAnalysis.analysis.hbonds"><tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.analysis.hbonds</span></tt></a><a class="headerlink" href="#hydrogen-bond-analysis-mdanalysis-analysis-hbonds" title="Permalink to this headline">¶</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Author:</th><td class="field-body">David Caplan</td>
</tr>
<tr class="field"><th class="field-name">Year:</th><td class="field-body">2010-2011</td>
</tr>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">GNU Public License v3</td>
</tr>
</tbody>
</table>
<p>Given a <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.Universe" title="MDAnalysis.core.AtomGroup.Universe"><tt class="xref py py-class docutils literal"><span class="pre">Universe</span></tt></a> (simulation
trajectory with 1 or more frames) measure all hydrogen bonds for each
frame between selections 1 and 2.</p>
<p>The <a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis"><tt class="xref py py-class docutils literal"><span class="pre">HydrogenBondAnalysis</span></tt></a> class is modeled after the <a class="reference external" href="http://www.ks.uiuc.edu/Research/vmd/plugins/hbonds/">VMD
HBONDS plugin</a>.</p>
<dl class="docutils">
<dt>Options:</dt>
<dd><ul class="first last simple">
<li><em>update_selections</em> (<tt class="xref docutils literal"><span class="pre">True</span></tt>): update selections at each frame?</li>
<li><em>selection_1_type</em> (&#8220;both&#8221;): selection 1 is the: &#8220;donor&#8221;, &#8220;acceptor&#8221;, &#8220;both&#8221;</li>
<li>donor-acceptor <em>distance</em> (Å): 3.0</li>
<li>Angle <em>cutoff</em> (degrees): 120.0</li>
<li><em>donors</em> and <em>acceptors</em> atom types (to add additional atom names)</li>
</ul>
</dd>
</dl>
<div class="section" id="output">
<span id="analysis-output"></span><h2>3.5.1. Output<a class="headerlink" href="#output" title="Permalink to this headline">¶</a></h2>
<p>The results are hydrogen bond data per frame (# indicates comments that are not part of the output):</p>
<div class="highlight-python"><pre>results = [
    [ # frame 1
       [ # hbond 1
          &lt;donor index&gt;, &lt;acceptor index&gt;, &lt;donor string&gt;, &lt;acceptor string&gt;, &lt;distance&gt;, &lt;angle&gt;
       ],
       [ # hbond 2
          &lt;donor index&gt;, &lt;acceptor index&gt;, &lt;donor string&gt;, &lt;acceptor string&gt;, &lt;distance&gt;, &lt;angle&gt;
       ],
       ....
    ],
    [ # frame 2
      [ ... ], [ ... ], ...
    ],
    ...
]</pre>
</div>
<p>Using the <a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.generate_table" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.generate_table"><tt class="xref py py-meth docutils literal"><span class="pre">HydrogenBondAnalysis.generate_table()</span></tt></a> method one can reformat
the results as a flat &#8220;normalised&#8221; table that is easier to import into a
database for further processing. <a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.save_table" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.save_table"><tt class="xref py py-meth docutils literal"><span class="pre">HydrogenBondAnalysis.save_table()</span></tt></a> saves
the table to a pickled file. The table itself is a <a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.recarray.html#numpy.recarray" title="(in NumPy v2.0.dev-ec56ee1)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.recarray</span></tt></a>.</p>
</div>
<div class="section" id="detection-of-hydrogen-bonds">
<h2>3.5.2. Detection of hydrogen bonds<a class="headerlink" href="#detection-of-hydrogen-bonds" title="Permalink to this headline">¶</a></h2>
<p>Hydrogen bonds are recorded based on a geometric criterion:</p>
<ol class="arabic simple">
<li>The distance between acceptor and hydrogen is less than or equal to
<em>distance</em> (default is 3 Å).</li>
<li>The angle between donor-hydrogen-acceptor is greater than or equal to
<em>angle</em> (default is 120º).</li>
</ol>
<p>The cut-off values <em>angle</em> and <em>distance</em> can be set as keywords to
<a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis"><tt class="xref py py-class docutils literal"><span class="pre">HydrogenBondAnalysis</span></tt></a>.</p>
<p>Donor and acceptor heavy atoms are detected from atom names. The current
defaults are appropriate for the CHARMM27 force field as defined in Table
<a class="reference internal" href="#default-atom-names-for-hydrogen-bonding-analysis">Default atom names for hydrogen bonding analysis</a>. Hydrogen atoms are
searched for as atom names following in sequence and starting with &#8216;H&#8217;.</p>
<table border="1" class="docutils" id="default-atom-names-for-hydrogen-bonding-analysis">
<caption>Default heavy atom names for hydrogen bonding analysis.</caption>
<colgroup>
<col width="15%" />
<col width="19%" />
<col width="15%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">group</th>
<th class="head">donor</th>
<th class="head">acceptor</th>
<th class="head">comments</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>main chain</td>
<td>N</td>
<td>O</td>
<td>&nbsp;</td>
</tr>
<tr><td>water</td>
<td>OH2, OW</td>
<td>OH2, OW</td>
<td>SPC, TIP3P, TIP4P (CHARMM27,Gromacs)</td>
</tr>
<tr><td>ARG</td>
<td>NE, NH1, NH2</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr><td>ASN</td>
<td>ND2</td>
<td>OD1</td>
<td>&nbsp;</td>
</tr>
<tr><td>ASP</td>
<td>&nbsp;</td>
<td>OD1, OD2</td>
<td>&nbsp;</td>
</tr>
<tr><td>CYS</td>
<td>SG</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr><td>CYH</td>
<td>&nbsp;</td>
<td>SG</td>
<td>possible false positives for CYS</td>
</tr>
<tr><td>GLN</td>
<td>NE2</td>
<td>OE1</td>
<td>&nbsp;</td>
</tr>
<tr><td>GLU</td>
<td>&nbsp;</td>
<td>OE1, OE2</td>
<td>&nbsp;</td>
</tr>
<tr><td>HIS</td>
<td>ND1, NE2</td>
<td>ND1, NE2</td>
<td>presence of H determines if donor</td>
</tr>
<tr><td>HSD</td>
<td>ND1</td>
<td>NE2</td>
<td>&nbsp;</td>
</tr>
<tr><td>HSE</td>
<td>NE2</td>
<td>ND1</td>
<td>&nbsp;</td>
</tr>
<tr><td>HSP</td>
<td>ND1, NE2</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr><td>LYS</td>
<td>NZ</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr><td>MET</td>
<td>&nbsp;</td>
<td>SD</td>
<td>see e.g. <a class="reference internal" href="#gregoret1991">[Gregoret1991]</a></td>
</tr>
<tr><td>SER</td>
<td>OG</td>
<td>OG</td>
<td>&nbsp;</td>
</tr>
<tr><td>THR</td>
<td>OG1</td>
<td>OG1</td>
<td>&nbsp;</td>
</tr>
<tr><td>TRP</td>
<td>NE1</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr><td>TYR</td>
<td>OH</td>
<td>OH</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<p>Donor and acceptor names are based on the CHARMM27 force field but will also
work for e.g. OPLS/AA (tested in Gromacs) . Residue names in the table are for
information only and are not taken into account when determining acceptors and
donors. This can potentially lead to some ambiguity in the assignment of
donors/acceptors for residues such as histidine or cytosine.</p>
<p>The lists of donor and acceptor names can be extended by providing lists of
atom names in the <em>donors</em> and <em>acceptors</em> keywords to
<a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis"><tt class="xref py py-class docutils literal"><span class="pre">HydrogenBondAnalysis</span></tt></a>. If the lists are entirely inapprpriate
(e.g. when analysing simulations done with a force field that uses very
different atom names or when analysing non-protein system) then one can derive
a new class and set the default lists oneself:</p>
<div class="highlight-python"><pre>class HydrogenBondAnalysis_OtherFF(HydrogenBondAnalysis):
      DEFAULT_DONORS = (....)      # add donor heavy atoms here
      DEFAULT_ACCEPTORS = (....)   # add acceptor heavy atoms here</pre>
</div>
<p>Then simply use the new class instead of the parent class.</p>
<p class="rubric">References</p>
<table class="docutils citation" frame="void" id="gregoret1991" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[Gregoret1991]</a></td><td>L.M. Gregoret, S.D. Rader, R.J. Fletterick, and
F.E. Cohen. Hydrogen bonds involving sulfur atoms in proteins. Proteins,
9(2):99–107, 1991. <a class="reference external" href="http://dx.doi.org/10.1002/prot.340090204">10.1002/prot.340090204</a>.</td></tr>
</tbody>
</table>
</div>
<div class="section" id="example">
<h2>3.5.3. Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<p>All protein-water hydrogen bonds can be analysed with</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">MDAnalysis.analysis.hbonds</span>

<span class="n">u</span> <span class="o">=</span> <span class="n">MDAnalysis</span><span class="o">.</span><span class="n">Universe</span><span class="p">(</span><span class="n">PSF</span><span class="p">,</span> <span class="n">PDB</span><span class="p">,</span> <span class="n">permissive</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="n">h</span> <span class="o">=</span> <span class="n">MDAnalysis</span><span class="o">.</span><span class="n">analysis</span><span class="o">.</span><span class="n">hbonds</span><span class="o">.</span><span class="n">HydrogenBondAnalysis</span><span class="p">(</span><span class="n">u</span><span class="p">,</span> <span class="s">&#39;protein&#39;</span><span class="p">,</span> <span class="s">&#39;resname TIP3&#39;</span><span class="p">,</span> <span class="n">distance</span><span class="o">=</span><span class="mf">3.0</span><span class="p">,</span> <span class="n">angle</span><span class="o">=</span><span class="mf">120.0</span><span class="p">)</span>
<span class="n">results</span> <span class="o">=</span> <span class="n">h</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
</pre></div>
</div>
<p>The results are also stored as the attribute <tt class="xref py py-attr docutils literal"><span class="pre">h.timeseries</span></tt>; see
<a class="reference internal" href="#analysis-output"><em>Output</em></a> for the format and further options.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Due to the way <a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis"><tt class="xref py py-class docutils literal"><span class="pre">HydrogenBondAnalysis</span></tt></a> is implemented, it is
more efficient to have the second selection (<em>selection2</em>) be the
<em>larger</em> group, e.g. the water when looking at water-protein
H-bonds or the whole protein when looking at ligand-protein
interactions.</p>
</div>
</div>
<div class="section" id="classes">
<h2>3.5.4. Classes<a class="headerlink" href="#classes" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis">
<em class="property">class </em><tt class="descclassname">MDAnalysis.analysis.hbonds.</tt><tt class="descname">HydrogenBondAnalysis</tt><big>(</big><em>universe</em>, <em>selection1='protein'</em>, <em>selection2='all'</em>, <em>selection1_type='both'</em>, <em>update_selection1=False</em>, <em>update_selection2=False</em>, <em>filter_first=True</em>, <em>distance=3.0</em>, <em>angle=120.0</em>, <em>donors=None</em>, <em>acceptors=None</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform a hydrogen bond analysis</p>
<p>The analysis of the trajectory is performed with the
<a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.run" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.run"><tt class="xref py py-meth docutils literal"><span class="pre">HydrogenBondAnalysis.run()</span></tt></a> method. The result is stored in
<tt class="xref py py-attr docutils literal"><span class="pre">HydrogenBondAnalysis.timeseries</span></tt>. See
<a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.run" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> for the format.</p>
<p>The default atom names are taken from the CHARMM 27 force field files but
also work for e.g. OPLS/AA in Gromacs.</p>
<dl class="docutils">
<dt><em>Donors</em> (associated hydrogens are deduced from topology)</dt>
<dd>N of the main chain, water OH2/OW, ARG NE/NH1/NH2, ASN ND2, HIS ND1/NE2,
SER OG, TYR OH, CYS SG, THR OG1, GLN NE2, LYS NZ, TRP NE1</dd>
<dt><em>Acceptors</em></dt>
<dd>O of the main chain, water OH2/OW, ASN OD1, ASP OD1/OD2, CYH SG, GLN OE1,
GLU OE1/OE2, HIS ND1/NE2, MET SD, SER OG, THR OG1, TYR OH</dd>
</dl>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">Table <a class="reference internal" href="#default-atom-names-for-hydrogen-bonding-analysis"><em>Default heavy atom names for hydrogen bonding analysis.</em></a></p>
</div>
<p>Set up calculation of hydrogen bonds between two selections in a universe.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first last docutils">
<dt><em>universe</em></dt>
<dd><p class="first last">Universe object</p>
</dd>
<dt><em>selection1</em></dt>
<dd><p class="first last">Selection string for first selection</p>
</dd>
<dt><em>selection2</em></dt>
<dd><p class="first last">Selection string for second selection</p>
</dd>
<dt><em>selection1_type</em></dt>
<dd><p class="first last">Selection 1 can be &#8216;donor&#8217;, &#8216;acceptor&#8217; or &#8216;both&#8217;</p>
</dd>
<dt><em>update_selection1</em></dt>
<dd><p class="first last">Update selection 1 at each frame?</p>
</dd>
<dt><em>update_selection2</em></dt>
<dd><p class="first last">Update selection 2 at each frame?</p>
</dd>
<dt><em>filter_first</em></dt>
<dd><p class="first last">Filter selection 2 first to only atoms 3*distance away</p>
</dd>
<dt><em>distance</em></dt>
<dd><p class="first last">Distance cutoff for hydrogen bonds</p>
</dd>
<dt><em>angle</em></dt>
<dd><p class="first last">Angle cutoff for hydrogen bonds</p>
</dd>
<dt><em>donors</em></dt>
<dd><p class="first last">Extra H donor atom types (in addition to those in
<a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.DEFAULT_DONORS" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.DEFAULT_DONORS"><tt class="xref py py-attr docutils literal"><span class="pre">DEFAULT_DONORS</span></tt></a>), must be a sequence.</p>
</dd>
<dt><em>acceptors</em></dt>
<dd><p class="first last">Extra H acceptor atom types (in addition to those in
<a class="reference internal" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.DEFAULT_ACCEPTORS" title="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.DEFAULT_ACCEPTORS"><tt class="xref py py-attr docutils literal"><span class="pre">DEFAULT_ACCEPTORS</span></tt></a>), must be a sequence.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<p>The timeseries is accessible as the attribute <tt class="xref py py-attr docutils literal"><span class="pre">HydrogenBondAnalysis.timeseries</span></tt>.</p>
<dl class="attribute">
<dt id="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.DEFAULT_ACCEPTORS">
<tt class="descname">DEFAULT_ACCEPTORS</tt><a class="headerlink" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.DEFAULT_ACCEPTORS" title="Permalink to this definition">¶</a></dt>
<dd><p>default atom names that are treated as hydrogen <em>acceptors</em>
(see <a class="reference internal" href="#default-atom-names-for-hydrogen-bonding-analysis"><em>Default heavy atom names for hydrogen bonding analysis.</em></a>)
Use the keyword <em>acceptors</em> to add a list of additional acceptor names.</p>
</dd></dl>

<dl class="attribute">
<dt id="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.DEFAULT_DONORS">
<tt class="descname">DEFAULT_DONORS</tt><a class="headerlink" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.DEFAULT_DONORS" title="Permalink to this definition">¶</a></dt>
<dd><p>default heavy atom names whose hydrogens are treated as <em>donors</em>
(see <a class="reference internal" href="#default-atom-names-for-hydrogen-bonding-analysis"><em>Default heavy atom names for hydrogen bonding analysis.</em></a>)
Use the keyword <em>donors</em> to add a list of additional donor names.</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.calc_angle">
<tt class="descname">calc_angle</tt><big>(</big><em>d</em>, <em>h</em>, <em>a</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.calc_angle" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the angle (in degrees) between two atoms with H at apex.</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.calc_eucl_distance">
<tt class="descname">calc_eucl_distance</tt><big>(</big><em>a1</em>, <em>a2</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.calc_eucl_distance" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the Euclidean distance between two atoms.</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.generate_table">
<tt class="descname">generate_table</tt><big>(</big><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.generate_table" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate a normalised table of the results.</p>
<p>The table is stored as a <a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.recarray.html#numpy.recarray" title="(in NumPy v2.0.dev-ec56ee1)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.recarray</span></tt></a> in the
attribute <tt class="xref py py-attr docutils literal"><span class="pre">table</span></tt> and can be used
with e.g. <a class="reference external" href="http://pypi.python.org/pypi/RecSQL">recsql</a>.</p>
<dl class="docutils">
<dt>Columns:</dt>
<dd><ol class="first last arabic simple" start="0">
<li>&#8220;time&#8221;</li>
<li>&#8220;donor_idx&#8221;</li>
<li>&#8220;acceptor_idx&#8221;</li>
<li>&#8220;donor_resnm&#8221;</li>
<li>&#8220;donor_resid&#8221;</li>
<li>&#8220;donor_atom&#8221;</li>
<li>&#8220;acceptor_resnm&#8221;</li>
<li>&#8220;acceptor_resid&#8221;</li>
<li>&#8220;acceptor_atom&#8221;</li>
<li>&#8220;distance&#8221;</li>
<li>&#8220;angle&#8221;</li>
</ol>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Analyze trajectory and produce timeseries.</p>
<p>Returns hydrogen bond data per frame (# indicates comments that are not part of the output):</p>
<div class="highlight-python"><pre>results = [
    [ # frame 1
       [ # hbond 1
          &lt;donor index&gt;, &lt;acceptor index&gt;, &lt;donor string&gt;, &lt;acceptor string&gt;, &lt;distance&gt;, &lt;angle&gt;
       ],
       [ # hbond 2
          &lt;donor index&gt;, &lt;acceptor index&gt;, &lt;donor string&gt;, &lt;acceptor string&gt;, &lt;distance&gt;, &lt;angle&gt;
       ],
       ....
    ],
    [ # frame 2
      [ ... ], [ ... ], ...
    ],
    ...
]</pre>
</div>
<p>The data are also stored as <tt class="xref py py-attr docutils literal"><span class="pre">HydrogenBondAnalysis.timeseries</span></tt>.</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.save_table">
<tt class="descname">save_table</tt><big>(</big><em>filename='hbond_table.pickle'</em><big>)</big><a class="headerlink" href="#MDAnalysis.analysis.hbonds.HydrogenBondAnalysis.save_table" title="Permalink to this definition">¶</a></dt>
<dd><p>Saves the table to a pickled file.</p>
<p>Load with</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">cPickle</span>
<span class="n">table</span> <span class="o">=</span> <span class="n">cPickle</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">))</span>
</pre></div>
</div>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference external" href="http://docs.python.org/library/pickle.html#module-cPickle" title="(in Python v2.7)"><tt class="xref py py-mod docutils literal"><span class="pre">cPickle</span></tt></a> module and <a class="reference external" href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.recarray.html#numpy.recarray" title="(in NumPy v2.0.dev-ec56ee1)"><tt class="xref py py-class docutils literal"><span class="pre">numpy.recarray</span></tt></a></p>
</div>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="helanal.html" title="3.6. HELANAL — analysis of protein helices"
             >next</a> |</li>
        <li class="right" >
          <a href="density.html" title="3.4. Generating densities from trajectories — MDAnalysis.analysis.density"
             >previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../analysis_modules.html" >3. Analysis modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2005-2011, Naveen Michaud-Agrawal, Elizabeth J. Denning, Joshua Adelman,
    Christian Beckstein (logo), David Caplan, Jan Domański, Philip Fowler,
    Joseph Goose, Benjamin Hall, Danny Parton, Tyler Reddy, Paul Rigor,
    and Oliver Beckstein.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>